﻿var syncValue = function () {
    var tree = this.component;
    var value = this.value;
    var ids = value.split(",");
    //tree.setChecked({ ids: ids, silent: true });

    //tree.getSelectionModel().deselectAll();
    //Ext.each(ids, function (id) {
    //    debugger;
    //    var node = tree.store.getNodeById(id);

    //    if (node) {
    //        tree.getSelectionModel().select(node, true);
    //    }
    //}, this);

    //FindOrgs(this,tree.root, value);
};

function FindOrgs(tree,node, value) {
 
    Ext.each(node.children, function (child) {
        debugger;
        if (child.id == value) {
            tree.getSelectionModel().select(child, true);
            return;
        }

        FindOrgs(tree,child, value); //递归选中子节点 
    });
 
}